package com.BGR.controller;

import com.BGR.common.R;
import com.BGR.entity.UpUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.BGR.service.UpUserService;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UpUserController {
    @Autowired
    private UpUserService upUserService;

    @PostMapping("save")
    public R saveUser(UpUser upUser){
        upUserService.saveUser(upUser);
        return R.ok();
    }

    @DeleteMapping("del")
    public R delUser(Long[] ids){
        upUserService.delUser(ids);
        return R.ok();
    }

    @PutMapping("update")
    public R updateUser(UpUser upUser){
        upUserService.updateUser(upUser);
        return R.ok();
    }

    @GetMapping("select")
    public R<List<UpUser>> pageUser(){
        //分页
        return R.ok(upUserService.selectUser());
    }
}
